﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Yu.Cms.Web.UserCtrl.Default
{
    public partial class Homecolumn : BaseCtrl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.OnStart();
            }
        }

        /// <summary>
        /// 初始化
        /// </summary>
        protected void OnStart()
        {
            this.BinderMenu();
            this.BinderMenuList();
        }

        /// <summary>
        /// 绑定菜单
        /// </summary>
        protected void BinderMenu()
        {
            RptMenu.DataSource = bllSmallType.GetTopList(8);
            RptMenu.DataBind();
        }

        /// <summary>
        /// 绑定列表
        /// </summary>
        protected void BinderMenuList()
        {
            RptMenuList.DataSource= bllSmallType.GetTopList(8);
            RptMenuList.DataBind();
        }

        protected void RptMenuList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Repeater RptMenuTitle = (Repeater)e.Item.FindControl("RptMenuTitle");
                HiddenField hid = (HiddenField)e.Item.FindControl("hid");
                int SmallTypeID=Yu.Cms.Common.Utils.StrToInt(hid.Value,0);
                RptMenuTitle.DataSource = bllContent.GetNewList(SmallTypeID, 8);
                RptMenuTitle.DataBind();
            }
        }
    }
}